// Package sys
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2025 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.11
package sys

import (
	"context"
	"hotgo/api/admin/auctionbidhistory"
	"hotgo/internal/model/input/sysin"
	"hotgo/internal/service"
)

var (
	AuctionBidHistory = cAuctionBidHistory{}
)

type cAuctionBidHistory struct{}

// List 查看出价日志列表
func (c *cAuctionBidHistory) List(ctx context.Context, req *auctionbidhistory.ListReq) (res *auctionbidhistory.ListRes, err error) {
	list, totalCount, err := service.SysAuctionBidHistory().List(ctx, &req.AuctionBidHistoryListInp)
	if err != nil {
		return
	}

	if list == nil {
		list = []*sysin.AuctionBidHistoryListModel{}
	}

	res = new(auctionbidhistory.ListRes)
	res.List = list
	res.PageRes.Pack(req, totalCount)
	return
}

// Export 导出出价日志列表
func (c *cAuctionBidHistory) Export(ctx context.Context, req *auctionbidhistory.ExportReq) (res *auctionbidhistory.ExportRes, err error) {
	err = service.SysAuctionBidHistory().Export(ctx, &req.AuctionBidHistoryListInp)
	return
}

// Edit 更新出价日志
func (c *cAuctionBidHistory) Edit(ctx context.Context, req *auctionbidhistory.EditReq) (res *auctionbidhistory.EditRes, err error) {
	err = service.SysAuctionBidHistory().Edit(ctx, &req.AuctionBidHistoryEditInp)
	return
}

// View 获取指定出价日志信息
func (c *cAuctionBidHistory) View(ctx context.Context, req *auctionbidhistory.ViewReq) (res *auctionbidhistory.ViewRes, err error) {
	data, err := service.SysAuctionBidHistory().View(ctx, &req.AuctionBidHistoryViewInp)
	if err != nil {
		return
	}

	res = new(auctionbidhistory.ViewRes)
	res.AuctionBidHistoryViewModel = data
	return
}

// Delete 删除出价日志
func (c *cAuctionBidHistory) Delete(ctx context.Context, req *auctionbidhistory.DeleteReq) (res *auctionbidhistory.DeleteRes, err error) {
	err = service.SysAuctionBidHistory().Delete(ctx, &req.AuctionBidHistoryDeleteInp)
	return
}
